using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

using SceneEngine;

namespace EnginePipeline
{
	[ContentTypeWriter]
    public class ModelInformationWriter : ContentTypeWriter<ModelInformation>
	{
        protected override void Write(ContentWriter output, ModelInformation value)
		{
            output.Write(value.OriginalTexturePaths.Count);

            if (value.OriginalTexturePaths.Count > 0)
            {
                for (int i = 0; i < value.OriginalTexturePaths.Count; i++)
                {
                    output.Write(value.OriginalTexturePaths[i]);
                    output.Write(value.RelativeTexturePaths[i]);
                }
            }
            
            output.Write(value.Vertices.Count);

            if (value.Vertices.Count > 0)
            {
                foreach (Vector3 vertex in value.Vertices)
                {
                    output.Write(vertex);
                }
            }
		}

		public override string GetRuntimeReader(TargetPlatform targetPlatform)
		{
            return "SceneEngine.ModelInformationReader, SceneEngine";
		}
	}
}
